<?php

namespace app\admin\model\clothmaking_boiler;

use think\Model;
use \app\admin\library\Auth;

class Record extends Model
{

    

    

    // 表名
    protected $name = 'clothmaking_boiler_record';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;
    protected $insert =['user_id'];
    protected $update = ['user_id'];

    public function setUserIdAttr()
    {
        $auth = Auth::instance();
        return $auth->id;
    }
    // 追加属性
    protected $append = [

    ];
    
    public function boiler()
    {
        return $this->belongsTo("\app\admin\model\clothmaking_boiler\Boiler","boiler_id");
    }
    
    public function raw()
    {
        return $this->belongsTo("\app\admin\model\clothmaking_raw\Index","raw_id");
    }

    public function plan()
    {
        return $this->belongsTo('app\admin\model\clothmaking\Plan', 'planid')->setEagerlyType(0);
    }







}
